package com.musicstore.aop;

import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.aspectj.lang.JoinPoint;

public class LogAdvice {
	public void doBefore(JoinPoint jp)
	{	
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String time= sdf.format( new Date()); 
		try {
			FileWriter writer=new FileWriter("d://mylog.txt",true);
			writer.write("时间:"+time);
			writer.write("，执行了类名:"+jp.getSignature()+"方法名："+jp.getSignature().getName()+"\n");
			writer.close();
		} catch (IOException e) {			
			e.printStackTrace();
		}
		
	}

}
